<?php
class ProductCourse extends Zend_Db_Table
{
	protected $_name ="product_course";
	protected $_primary = 'id';

 //根据id 查询product_course
    public function getproductcourseByid($id){
          $select = $this->select();
          $select->where("id=".$id);
          return $this->fetchAll($select)->toArray();
    }

 //根据product_id 查询product_course
    public function getproductcourseByproduct_id($product_id){
          $select = $this->select();
          $select->where("product_id=".$product_id);
          return $this->fetchAll($select)->toArray();
    }

 //更新product
    public function updateproductcourseByid($array,$id){

		$db = $this->getAdapter();
		$where=$db->quoteInto('id = ?', $id);
		$this->update($array, $where);
	}
//删除product
     public function delproductcourseByid($id){
          $where = 'id = '. $id;
         $this->delete($where);
         return true;
    }
//删除product_course
     public function delproductcourseBycourseid($course_id,$product_id){
          $where = 'course_id = '. $course_id .' and product_id='.$product_id;
         $this->delete($where);
         return true;
    }

}

